<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
   <title>virtuaPol Documentation</title>
   <link rel="stylesheet" href="assets/yui-combo.css" type="text/css">
   <style type="text/css">
   a { color: black; }
   img { border: 0; }
   #custom-doc { width: 80%; min-width: 250px; }
   #custom-doc #hd {width:100%;border-bottom: 1px dashed grey;text-align: center;}
   #custom-doc #hd #banner {margin: 3 10;}
   #custom-doc #ft {height: 70px; border-top: 1px dashed grey; text-align: right;}
   #custom-doc .yui-g {}
   #custom-doc .yui-u {overflow:hidden;}
   #sidebar {border-right: 1px solid #ddd;min-height:200px;}
   #menutree {width:100%; height:100%;}
   #content {overflow:hidden;}
   #content h1 {font-weight: bold; font-size: 15pt; margin:10px 0;}
   #content h2 {font-weight: bold; font-size: 13pt; margin:10px 0;}
   #content hr {width: 600px; margin: 15px 10px; border-color:grey;}
   #content ul {}
   #content ul li {}
   #content #method-list {}
   #content .box {width: 600px;border: 1px dashed grey; background-color:rgb(250,165,50); padding: 5px; margin: 15px 5px;}
   #content .box h3 {font-weight:bold; font-style:italic;margin-bottom:3px;margin-left:4px;}
   #content .method-detail {background-color: #ddbbaa;}
   #content .method-detail h2 {font-weight:bold; font-size: 13pt;}
   #content .method-detail .box {width: 90%; margin:6px 4px; padding: 3px;}
   </style>
   <script type="text/javascript" src="assets/lua-api.js"></script>
   <script type="text/javascript" src="assets/yui-combo.js"></script>
   <script language="Javascript" type="text/javascript">
(function() {
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        sidebar = null,
        container = null,
        tree = null;
		
    function checkHeight() {
    	var hMenu = parseInt(Dom.getStyle('menutree', 'height')),
    			hCont = parseInt(Dom.getStyle('content', 'height'));
    	if (hMenu > hCont)
    		Dom.setStyle('sidebar', 'height', hMenu+'px');
    	else
    		Dom.setStyle('sidebar', 'height', hCont+'px');
    }
        
    Event.onDOMReady(function() {
        var size = parseInt(Dom.getStyle('custom-doc', 'width'), 10);
        sidebar = Dom.get('sidebar');
        container = Dom.get('content');
        var max = (size - 650);
        var resize = new YAHOO.util.Resize('sidebar', {
            handles: ['r'],
            minWidth: 250,
            maxWidth: max
        });
        resize.on('resize', function(ev) {
            var w = ev.width;
            Dom.setStyle(sidebar, 'height', '');
            Dom.setStyle(container, 'width', (size - w - 15) + 'px');
        });
        resize.on('endResize', function() {
        	checkHeight();
        });

        resize.resize(null, 250, 250, 0, 0, true);
        
        tree = new YAHOO.widget.TreeView("menutree");
      	var node = new YAHOO.widget.TextNode("Home", tree.getRoot(), false);
      	node.href = "index.html";
        if (API_DATA != null && API_DATA.LUA != null) {
        	var luaNode = new YAHOO.widget.TextNode("Lua Api Reference", tree.getRoot(), false);
        	for(var i = 0; i < API_DATA.LUA.length; i++) {
        		var tmpNode = new YAHOO.widget.TextNode(API_DATA.LUA[i].name, luaNode, false);
        		tmpNode.classDefinition = API_DATA.LUA[i];
        	}
        }
        node = new YAHOO.widget.TextNode("LuaInterface Documentation (PDF)", tree.getRoot(), false);
        node.href = "luainterface.pdf";
        node.target = "_blank";
        node = new YAHOO.widget.TextNode("Programming with Lua (lua.org)", tree.getRoot(), false);
        node.href = "http://www.lua.org/pil/index.html";
        node.target = "_blank";
        node = new YAHOO.widget.TextNode("Lua 5.1 Reference Manual (lua.org)", tree.getRoot(), false);
        node.href = "http://www.lua.org/manual/5.1/";
        node.target = "_blank";
        tree.subscribe("labelClick", function(node) {
        	if (node.href != null && node.href != "") {
        		if (node.target == "_blank")
        			window.open(node.href, "_blank", "location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
        		else
        			document.location = node.href;
        	} else if (node.classDefinition != null) {
        		var c = node.classDefinition,
        			page = Dom.get('content'),
        			details = '';
        			
        		content = '<h1>'+c.name+' class</h1>'
        				+ '<div class="box">' + c.description + '</div>'
        				+ '<div class="box"><h3>Properties:</h3><ul id="property-list">';
        				
        		details += '</ul><h2>Properties:</h2>'
        		for(var i = 0; i < c.properties.length; i++) {
        			content += '<li><a href="#property-'+i+'">'
        							+  c.properties[i].name + ' :' + c.properties[i].type + '</a></li>';
        			details += '<div class="method-detail box"><a name="property-'+i+'" /><h2>'
        							+  c.properties[i].name + ' :' + c.properties[i].type + '</h2>'
        							+  '<div class="box"><h3>Access:</h3><p>'
        							+  (c.properties[i].get ? 'read, ' : '<strike>read</strike>, ')
        							+  (c.properties[i].set ? 'write' : '<strike>write</strike>')
        							+  '</p><h3>Description:</h3><p>' + c.properties[i].description
        							+  '</p></div></div>';
        		}
        		content += '</ul><h3>Methods:</h3><ul id="method-list">'
        		details += '<hr /><h2>Methods:</h2>';
        		for(var i = 0; i < c.methods.length; i++) {
        			details += '<div class="method-detail box"><a name="method-'+i+'" /><h2>'+c.methods[i].name+'( ';
        			content += '<li><a href="#method-'+i+'">'+c.methods[i].name+"( ";
        			var args = "";
        			for(var j = 0; j < c.methods[i].arguments.length; j++) {
        				if (j > 0) { content += ", "; details += ", "; }
        				content += c.methods[i].arguments[j].type;
        				details += c.methods[i].arguments[j].type+' <i>'
        								+		c.methods[i].arguments[j].name+'</i>';
        				args += '<li><b>'+c.methods[i].arguments[j].type+' <i>'
        									+c.methods[i].arguments[j].name+'</i></b> '
        									+c.methods[i].arguments[j].description+'</li>';
        			}
        			content += " ) : "+c.methods[i].returns+"</a></li>";
        			details += ' ) : '+c.methods[i].returns+'</h2><div class="box"><h3>Arguments:</h3>'
        							+		'<ul>'+args+'</ul></div><div class="box"><h3>Description:</h3><p>'
        							+		c.methods[i].description+'</p></div>'
        							+		'<div class="box"><h3>Example:</h3><pre>'+c.methods[i].example
        							+		'</pre></div></div>';
        		}
        		
        		content += "</ul></div><hr />" + details;
        		
        			
        		page.innerHTML = content;
        		checkHeight();
        	}
        });
        
        // Render tree
        tree.draw();
    });

})();

   </script>
</head>
<body>
<div id="custom-doc" class="yui-t7">
  <div id="hd">
   	<img src="assets/banner.png" id="banner" />	
 	</div>
  <div id="bd">
		<div class="yui-gf">
    	<div class="yui-u first" id="sidebar">
				<!-- NAVIGATION GOES HERE -->
				<div id="menutree"></div>
	    </div>
    	<div class="yui-u" id="content">
				<!-- DATA GOES HERE -->
				<h1>VirtuaPol Documentation</h1>
				<p>This is the virtuaPol documentation. You will find everything you need to be up and running with virtuaPol in no time</p>
	    </div>
		</div>
	</div>
  <div id="ft"><p>&copy; 2009 Lukas Botsch</p></div>
</div>

</body>
</html>
